<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>校园课程管理系统 - 登录</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
    <style>
        body {
            background-color: #f5f5f5;
            font-family: 'Arial', sans-serif;
        }
        .login-container {
            max-width: 400px;
            margin: 100px auto;
            padding: 30px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .login-title {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
        }
    </style>
</head>
<body>
<div class="login-container">
    <h2 class="login-title">校园课程管理系统</h2>
    <form id="loginForm">
        <div class="mb-3">
            <label for="username" class="form-label">用户名</label>
            <input type="text" class="form-control" id="username" required>
        </div>
        <div class="mb-3">
            <label for="password" class="form-label">密码</label>
            <input type="password" class="form-control" id="password" required>
        </div>
        <div class="mb-3 form-check">
            <input type="checkbox" class="form-check-input" id="rememberMe">
            <label class="form-check-label" for="rememberMe">记住我</label>
        </div>
        <button type="button" class="btn btn-primary w-100" id="loginBtn">登录</button>
        <div class="text-center mt-3">
            <a href="#" id="forgotPassword">忘记密码?</a>
        </div>
    </form>
</div>

<script>
    document.getElementById('loginBtn').addEventListener('click', function() {
        const username = document.getElementById('username').value;
        const password = document.getElementById('password').value;

        // 这里应该是向后端发送登录请求的代码
        console.log('登录请求: 用户名=', username, '密码=', password);

        // 模拟登录成功，跳转到主界面
        // 实际应用中，这里应该根据后端返回的用户角色来设置
        const role = 'student'; // 可以是 'student', 'teacher', 'admin'
        window.location.href = `index.html?role=${role}&username=${username}`;
    });
</script>
</body>
</html>